package cn.stylefeng.guns.modular.leavelog.controller;


import java.util.List;
import java.util.Map;


import cn.hutool.core.bean.BeanUtil;
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.leaveinfo.model.LeaveInfoParam;
import cn.stylefeng.guns.modular.leaveinfo.model.LeaveInfoResult;
import cn.stylefeng.guns.modular.leaveinfo.service.LeaveInfoService;
import cn.stylefeng.guns.sys.modular.system.entity.LeaveInfoPO;
import cn.stylefeng.roses.kernel.model.response.ResponseData;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/leaveLog")
public class LeaveLogController {

    @Autowired
    private LeaveInfoService leaveInfoService;

    private String PREFIX = "/leaveLog";

    /**
     * 跳转到主页面
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/leaveLog.html";
    }


    /**
     * 查询列表
     *
     * @author stylefeng
     * @Date 2019-02-18
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(LeaveInfoParam leaveInfoParam) {
        Page page = LayuiPageFactory.defaultPage();
        List<LeaveInfoResult> results = leaveInfoService.getAllList(leaveInfoParam);
        page.setRecords(results);
        return LayuiPageFactory.createPageInfo(page);
    }
}


